<%@page import="org.jeecgframework.web.util.StaticValue"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<div class="easyui-layout" fit="true">
	<div region="center" style="padding:1px;">
		<t:datagrid name="zySendInspectionPlanList" checkbox="true" fitColumns="false" title="巡检计划" pageList="[20,100,1000]"  
			actionUrl="zyInspectionPlanController.do?datagridOfSendPlanList" idField="id" fit="true" queryMode="group" autoLoadData="flase" sortName="state" >
			<t:dgCol title="主键"			field="id"  	hidden="true"	queryMode="single"  width="120" />
			<t:dgCol title="巡检计划ID"		field="planId"    								queryMode="single"  query="true"	width="100" url="zyInspectionPlanController.do?detailsOfPlan&id={id}" funname="planDetials" />
			<t:dgCol title="巡检计划状态"	field="state"									queryMode="single"		dictionary="<%=StaticValue.DIC_PLAN_STATE %>" width="110" defaultSelectVal="<%=StaticValue.DIC_PLAN_STATE_TODO %>" />
			<t:dgCol title="巡检计划状态"  field="state1" hidden="true"  query="true"></t:dgCol>
			<t:dgCol title="巡检计划状态"  field="state2" hidden="true"  query="true"></t:dgCol>
			<t:dgCol title="设备SN"			field="equipmentSpare.sn"    					queryMode="single"	query="true"	width="90" />
			<t:dgCol title="BP"				field="equipmentSpare.bpNo"    					queryMode="single"	query="true"    width="80" />
			<t:dgCol title="巡检计划备注"	field="remarks"    								width="220" sortable="false" />
			<t:dgCol title="影院名称"		field="equipmentSpare.zyCinema.name"			queryMode="single"  query="true"	width="180" sortable="false" />
			<t:dgCol title="省市"			field="tsTerritoryVal"							width="100"	sortable="false" />
			<t:dgCol title="省市"			field="equipmentSpare.tsTerritory.territoryName"	hidden="true"	queryMode="single"  query="true" sortable="false" />
			<t:dgCol title="影院地址"		field="equipmentSpare.zyCinema.address"			width="300"	sortable="false"/>
			<t:dgCol title="光路"			field="lightPath"			width="60"	sortable="false" dictionary="<%=StaticValue.DIC_LIGHT_PATH %>" />
			<t:dgCol title="保修开始日期"	field="equipmentSpare.warrantyBeginDate"		width="100"	sortable="false" formatter="yyyy-MM-dd"/>
			<t:dgCol title="保修期"			field="equipmentSpare.repairDate"				width="120"	sortable="false"/>
			<t:dgCol title="派单指示"		field="equipmentSpare.sendSign.shortname"		width="180"	sortable="false" dictionary="t_s_depart,id,departname"/>
			<t:dgCol title="巡检单位"		field="company"									queryMode="single"  query="true"	dictionary="<%=StaticValue.DIC_INSPECTION_COMPANY %>" width="80"/>
			<t:dgCol title="去年巡检日期"	field="equipmentSpare.lastYearInspectionDate"	width="100"		formatter="yyyy-MM-dd" />
			<t:dgCol title="计划巡检月份"	field="ipPlanDate"								width="150"		sortable="true" formatter="yyyy年-MM月" query="true" queryMode="group"/>
			<t:dgCol title="预约上门时间"	field="engineerOrderTime"						width="90"		formatter="yyyy-MM-dd" />
			<t:dgCol title="创建时间"		field="createDate"						width="130"		formatter="yyyy-MM-dd hh:mm:ss" />
			<t:dgCol title="最后更新时间"	field="updateDate"						width="130"		formatter="yyyy-MM-dd hh:mm:ss" />
			<t:dgCol title="巡检完工时间"	field="reportCommitTime"			hidden="true"	query="true" queryMode="group"		width="130"		formatter="yyyy-MM-dd hh:mm:ss" />
<%--			<t:dgCol title="巡检联系人"		field="contacter.name"							width="70"	/>--%>
			
			<t:dgCol title="操作" field="opt" width="100"></t:dgCol>
			<t:dgFunOpt operationCode="fenpai" funname="sendPlanCol(id)" title="分派" exp="state#eq#${optRule }"></t:dgFunOpt>
			<t:dgToolBar operationCode="adds" title="批量分派" icon="icon-add" url="" funname="sendPlanToolBar"></t:dgToolBar>
			<t:dgToolBar operationCode="daochu" title="导出" icon="icon-putout" url="" funname="exportIp"></t:dgToolBar>


<%--			<t:dgToolBar title="##测试实时新增巡检计划##" icon="icon-add" url="zyInspectionPlanController.do?autoGenerateInspectionPlan" funname="testCheckReport"></t:dgToolBar> --%>
<%--			<t:dgToolBar title="##测试-每日导入安装记录##" icon="icon-add" url="zyInspectionPlanController.do?zyRecordImport" funname="testCheckIp"></t:dgToolBar>--%>
<%-- 			<t:dgToolBar title="##测试每年一月一日定时##" icon="icon-add" url="zyInspectionPlanController.do?getInfoFromLastYearIps" funname="testGetInfoFromLastYearIps"></t:dgToolBar>--%>
<%-- 			<t:dgToolBar title="##测试检查巡检报告标准值##" icon="icon-add" url="zyInspectionPlanController.do?checkReport" funname="testCheckReport"></t:dgToolBar> --%>
<%--			<t:dgToolBar title="##测试-检查工程师巡检代办##" icon="icon-add" url="zyInspectionPlanController.do?timeTaskOfCheckPlanOfEngineer" funname="testCheckIp"></t:dgToolBar>--%>
			
		</t:datagrid>
	</div>
</div>
<script type="text/javascript">
$(function(){
	$("#zySendInspectionPlanListtb").find("input[name='actualDate_begin']").attr({"class":"Wdate","id":"actualDate_begin","style":"height:20px;width:90px;"}).click(function(){
		WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'#F{$dp.$D(\'actualDate_end\')}'});
		});
	$("#zySendInspectionPlanListtb").find("input[name='actualDate_end']").attr({"class":"Wdate","id":"actualDate_end","style":"height:20px;width:90px;"}).click(function(){
		WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'actualDate_begin\')}'});
		});
	$("#zySendInspectionPlanListtb").find("input[name='ipPlanDate_begin']").attr({"class":"Wdate","id":"ipPlanDate_begin","style":"height:20px;width:90px;"}).click(function(){
		WdatePicker({dateFmt:'yyyy-MM',maxDate:'#F{$dp.$D(\'ipPlanDate_end\')}'});
		});
	$("#zySendInspectionPlanListtb").find("input[name='ipPlanDate_end']").attr({"class":"Wdate","id":"ipPlanDate_end","style":"height:20px;width:90px;"}).click(function(){
		WdatePicker({dateFmt:'yyyy-MM',minDate:'#F{$dp.$D(\'ipPlanDate_begin\')}'});
		});
	$("#zySendInspectionPlanListtb").find("input[name='reportCommitTime_begin']").attr({"class":"Wdate","id":"reportCommitTime_begin","style":"height:20px;width:90px;"}).click(function(){
		WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'#F{$dp.$D(\'reportCommitTime_end\')}'});
		});
	$("#zySendInspectionPlanListtb").find("input[name='reportCommitTime_end']").attr({"class":"Wdate","id":"reportCommitTime_end","style":"height:20px;width:90px;"}).click(function(){
		WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'reportCommitTime_begin\')}'});
		});
	territoryLink('zySendInspectionPlanList','equipmentSpare.tsTerritory.territoryName',1);
	setTimeout(function(){//延时调用查询，因为datagrid的field中的formatter 没有执行完毕
		zySendInspectionPlanListsearch();
<%--		/** 这里之所以没有调用 datagridTag生成的 zySendInspectionPlanListsearch(); 因为有额外的参数是从首页点击代办任务跳转过来的，--%>
<%--			如果把首页带来的参数拼接到 datagrid 配置的 url 中那么 不论怎么查询 都会带着首页来的参数。--%>
<%--			所以 这里硬性的 加载了 datagrid--%>
<%--		*/--%>
<%--		var queryParams = $('#zySendInspectionPlanList').datagrid('options').queryParams;--%>
<%--		$('#zySendInspectionPlanListtb').find('*').each(function() {--%>
<%--			queryParams[$(this).attr('name')] = $(this).val();--%>
<%--		});--%>
<%--		/**--%>
<%--		！！！所以注意：下边的 url 中的 field 一定要和 上边 datagird中的field对应上，否则会出现异常--%>
<%--		*/--%>
<%--		$('#zySendInspectionPlanList').datagrid({--%>
<%--			url: 'zyInspectionPlanController.do?datagridOfSendPlanList' + --%>
<%--					'&field=id,planId,state,equipmentSpare.sn,remarks,equipmentSpare.zyCinema.name,tsTerritoryVal,equipmentSpare.tsTerritory.territoryName,equipmentSpare.zyCinema.address,equipmentSpare.companyOfRenewal,equipmentSpare.warrantyBeginDate,equipmentSpare.repairDate,equipmentSpare.sendSign,company,equipmentSpare.lastYearInspectionDate,orderBeginToEndVal,engineerOrderTime,createDate,updateDate',--%>
<%--			pageNumber: 1--%>
<%--		});--%>
	},500);
});

$(function () {
    $("div[name='searchColums'] span:nth-child(2)").hide();
    $("[name='state2']").combobox({
        data:[{
            "id":"a_todo",
            "text":"待处理"
        },{
            "id":"b_sended_to_thirdParty",
            "text":"已分派第三方"
        },{
            "id":"c_third_party_refuse",
            "text":"第三方拒绝",
        },{
            "id":"d_third_party_assigned",
            "text":"第三方已分配"
        },{
            "id":"e_engineer_refused",
            "text":"工程师拒绝"
        },{
            "id":"f_engineer_assigned",
            "text":"工程师接受"
        },{
            "id":"g_engineer_in_implement",
            "text":"工程师实施中"
        },{
            "id":"h_aeg_refused",
            "text":"区域工程师拒绝"
        },{
            "id":"i_aeg_assigned",
            "text":"区域工程师已分配"
        },{
            "id":"j_inspection_complete",
            "text":"已完成巡检计划"
        },{
            "id":"k_inspection_cancel",
            "text":"巡检计划已取消"
        }],
        valueField: 'id',
        textField: 'text',
        editable:false,
        multiple:true,
        onSelect: function (row) { //选中一个选项时调用
            //获取选中的值的values
            $("[name='state1']").val($(this).combobox('getValues'));
        },
        onUnselect: function (row) {//不选中一个选项时调用
            //获取选中的值的values
            $("[name='state1']").val($(this).combobox('getValues'));
        }
    });
})

function searchReset(zySendInspectionPlanList){
    $("#"+zySendInspectionPlanList+"tb").find("input").val("");
    $("select").find("option[value='']").attr("selected", true);
    $("#state2").combobox('clear');
}

//遮罩，批量分派 回调。勿删
function closeProgress(data){
	lockmask(false);
	zySendInspectionPlanListsearch();
}
function testCheckIp(title,url){
	$.post(url,function(){
		tip("执行完毕");
	});
}
function testCheckReport(title,url){
	$.post(url,function(){
		tip("执行完毕");
	});
}
function testGetInfoFromLastYearIps(title,url){
	$.post(url,function(){
		tip("执行完毕");
	});
}
</script>
<script type="text/javascript" src="webpage/com/zybk/zy_inspection_plan/zyInspectionPlanList.js"></script>